﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace BestClient
{
    public class BestConstant {
    public const string CODE_OK = "00000000";
    //system id
    public const string SYSTEM_ID_COMMON = "common";
    public const string SYSTEM_ID_COMMAND = "command";
    public const string SYSTEM_ID_RESPONSE = "response";
    public const string SYSTEM_ID_BOSS = "boss";
    public const string SYSTEM_ID_SIGNAL = "single";
    public const string SYSTEM_ID_BROADCAST = "broadcast";
    public const string SYSTEM_ID_DEVICE = "dev";
    //sid
    public const string SERVICE_ID_REGISTER = "dms.common.device.register";
    public const string SERVICE_ID_DETERMINE_PROTOCOL = "dms.common.device.protocol";
    public const string SERVICE_ID_LOGIN = "dms.common.device.login";
    public const string SERVICE_ID_REPORT = "dms.boss.device.report";
    public const string SERVICE_ID_SUBSCRIBE = "dms.common.device.subscribe";

    public const string SERVICE_ID_UPLOAD_PERSONAL_SNAPSHOT = "ems.common.person.snapshot";
    public const string SERVICE_ID_UPLOAD_COMMAND_SNAPSHOT = "cms.cache.cmd.snapshot";
    public const string SERVICE_ID_COMMAND_SYNC_NOTICE = "cpe.cms.cmd.notice";
    public const string SERVICE_ID_PERSON_SYNC_NOTICE = "cpe.ems.person.notice";
    public const string SERVICE_ID_PERSON_SYNCHRONIZE = "ems.common.person.synchronize";
    public const string SERVICE_ID_COMMAND_SYNCHRONIZE = "cms.cache.cmd.synchronize";

    public const string SERVICE_ID_COMMAND_PERSON_DELETE = "cpe.ems.person.delete";
    public const string SERVICE_ID_COMMAND_COUNT_UPLOAD = "cpe.bms.data.upload";
    public const string SERVICE_ID_COMMAND_REBOOT_DEVICE = "cpe.dms.device.reboot";
    public const string SERVICE_ID_COMMAND_RELAY_ON = "cpe.dms.device.relayStatus";
    public const string SERVICE_ID_COMMAND_DEVICE_INFORMATION = "cpe.dms.device.getDeviceInfo";
    public const string SERVICE_ID_COMMAND_DEVICE_SETTING = "cpe.dms.device.set";
    public const string SERVICE_ID_COMMAND_CLEAR_COUNT = "cpe.dms.device.clearCountData";
    public const string SERVICE_ID_COMMAND_CLEAR_RECOGNITION = "cpe.dms.device.clearRecognitionData";
    public const string SERVICE_ID_COMMAND_CLEAR_PHOTO = "cpe.dms.device.clearCachePhoto";
    public const string SERVICE_ID_COMMAND_CLEAR_ALL = "cpe.dms.device.clearAll";
    public const string SERVICE_ID_COMMAND_SET_GROUP = "cpe.ems.group.set";
    public const string SERVICE_ID_COMMAND_SYNC_ALL_PERSON = "cpe.ems.person.syncAll";

    //set camera foe ios
    public const string SERVICE_ID_COMMAND_CAMERA_INFORMATION ="cpe.dms.device.cameraInfo";

    public const string SERVICE_ID_UPLOAD_COUNT = "bms.boss.count.upload";
    public const string SERVICE_ID_UPLOAD_RECOGNITION = "bms.boss.recognition.upload";
    public const string SERVICE_ID_UPLOAD_ALARM_LOG = "bms.boss.event.upload";
    public const string SERVICE_ID_UPLOAD_PHOTO = "bms.boss.photo.upload";
    public const string SERVICE_ID_UPLOAD_DEVICE_INFORMATION = "dms.device.info.upload";

    //error code finds
    public const string WAIT_ERROR = "request_stop_error";
    public const string RESEND_ERROR = "request_resend_error";
    public const string ACCESS_ERROR = "request_access_error";
    public const string DELETE_ERROR = "request_delete_error";
    public const string UPDATE_SNAPSHOT_ERROR = "request_update_snapshot_error";
    public const string UPDATE_SNAPSHOT_DATA_ERROR = "request_update_snapshot_data_error";
    public const string NOT_FOUND_ERROR = "not_find_error";

    //error code for sending to server,include db operation,reboot and so on
    //E4D00001-E4D99999
    public const string DEVICE_OTHER_ERROR = "E4D00001";
    public const string REBOOT_DEVICE_FAIL = "E4D00002";
    public const string SET_CAMERA_INFORMATION_FAIL = "E4D00003";
    public const string DB_CLEAR_COUNT_FAIL = "E4D00004";
    public const string DB_CLEAR_RECOGNITION_FAIL = "E4D00005";
    public const string DB_CLEAR_ALL_FAIL = "E4D00006";
    public const string DB_CLEAR_PHOTO_FAIL = "E4D00007";
    public const string DB_DELETE_PERSON_FAIL = "E4D00008";
    public const string DB_SET_GROUP_FAIL = "E4D00009";

    private static Dictionary<string, string> errorMap = new Dictionary<string, string>();

    
    }

    public class ErrorCode
    {
        private static Hashtable CodeList = new Hashtable();


        static ErrorCode()
        {
            CodeList.Add("E2D21001", "ACCESS_ERROR");
            CodeList.Add("E2D21002", "WAIT_ERROR");
            CodeList.Add("E2D21003", "RESEND_ERROR");
            CodeList.Add("E2D21004", "DELETE_ERROR");
            CodeList.Add("E2D21005", "UPDATE_SNAPSHOT_ERROR");
            CodeList.Add("E2D21006", "UPDATE_SNAPSHOT_DATA_ERROR");
        }

        public static string getError(string code)
        {

            return CodeList[code].ToString();

        }
    }
}
